@echo off &PUSHD %~DP0 &TITLE 绿化和选项
mode con cols=29 lines=20
color 2F
SetLocal EnableDelayedExpansion
:: 检查权限
net session >nul 2>&1
if not %errorlevel% == 0 (
  echo 请使用右键 "已管理员身份运行" 此脚本
  pause
  exit 1
)

:Menu
Cls
@ echo.
@ echo.　  　  菜 单 选 项
@ echo.
@ echo.       ADD → 请输入1
@ echo.
@ echo.       DEL → 请输入2
@ echo.
set /p xj= 功能选择：
if /i "%xj%"=="1" Goto ADD
if /i "%xj%"=="2" Goto Delete
@ echo.
@echo      选择无效，请重新输入
ping -n 2 127.1>nul
goto menu
cd /d %~dp0
:ADD
@set /p gate= 输入网关：
@echo 导入路由表...
:: rundll32.exe cmroute.dll,SetRoutes /STATIC_FILE_NAME add.txt /DONT_REQUIRE_URL /IPHLPAPI_ACCESS_DENIED_OK
route add 10.11.0.0 mask 255.255.255.0 %gate% >NUL 2>NUL
for /F "tokens=2,4 delims= " %%i in (add.txt) do @route add %%i mask %%j %gate% >NUL 2>NUL
@ ECHO.
ECHO 　　　导入完成..
ping -n 2 127.8>nul
goto menu

:Delete
@echo 清理路由表...
route delete 10.11.0.0 >NUL 2>NUL
for /F "tokens=2,4 delims= " %%i in (add.txt) do @route delete %%i >NUL 2>NUL
@ ECHO.
ECHO 　　　清理完成..
ping -n 2 127.8>nul
goto menu